/*
 * XXX
 */

package edu.uhcl.csci4838.group3.view;

import edu.uhcl.csci4838.group3.R;
import android.app.TabActivity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;


/**
 * XXX
 * 
 * @author Chris Waguespack
 *
 */
public class CourseActivity extends TabActivity {
	/**
	 * XXX
	 * 
	 * @param savedInstanceState
	 */
	/* 
	 * (non-Javadoc)
	 * 
	 * @see android.app.ActivityGroup#onCreate(android.os.Bundle)
	 */
	@Override
	public void onCreate(final Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setRequestedOrientation(
				ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
		this.setContentView(R.layout.activity_course);
		final Resources res = this.getResources();
		final TabHost tabHost = this.getTabHost();
		TabHost.TabSpec spec;
		Intent intent;
		Intent callingIntent = getIntent();
		
		// Create an Intent to launch an Activity for the tab(to be reused)s
		intent = new Intent().setClass(this,
				CourseInfoTabActivity.class);
		intent.putExtras(callingIntent.getExtras());
		
		// Initialize a TabSpec for each tab and add it to the TabHost
		spec = tabHost.newTabSpec("info")
				.setIndicator("Info",
						res.getDrawable(R.drawable.ic_tab_info))
				.setContent(intent);
		tabHost.addTab(spec);
		
		intent = new Intent().setClass(this,
				TaskListActivity.class);
		intent.putExtras(callingIntent.getExtras());
		spec = tabHost.newTabSpec("tasks")
				.setIndicator("Tasks",
						res.getDrawable(R.drawable.ic_tab_tasks))
				.setContent(intent);
		tabHost.addTab(spec);
		
		intent = new Intent().setClass(this,
				GradesActivity.class);
		intent.putExtras(callingIntent.getExtras());
		spec = tabHost.newTabSpec("grades")
				.setIndicator("Grades",
						res.getDrawable(R.drawable.ic_tab_grades))
				.setContent(intent);
		tabHost.addTab(spec);
		
//		intent = new Intent().setClass(this,
//				ContentActivity.class);
//		intent.putExtras(callingIntent.getExtras());
//		spec = tabHost.newTabSpec("content")
//				.setIndicator("Content",
//						res.getDrawable(R.drawable.ic_tab_content))
//				.setContent(intent);
//		tabHost.addTab(spec);
		
		tabHost.setCurrentTabByTag("info");
	}
}
